
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <ul>
      <li v-for='item in list'>{{item}}</li>
    </ul>
    <button @click="add">增加</button>
    <button @click="modify">修改</button>
  </div>
  <script type="text/javascript" src="js/vue.js"></script>
  <script type="text/javascript">
    var vm = new Vue({
      el: '#app',
      data: {
        list: ['apple', 'orange', 'banana']
      },
      methods: {
        add: function(){
          this.list.push('mango')
        },
        modify: function() {
          this.$set(this.list,2,"lalalal")
        }
      }
    });
    // 点击增加的按钮, 观察界面
    // 点击修改的按钮, 观察界面, 如何解决这个问题?
    //数组通过索引操作数组，不会触发响应式更新
     
  </script>
</body>
</html>
